home *** CD-ROM | disk | FTP | other *** search
/ Mega Guia 2004 June / Mega Guia: 2004-06.iso / _files / free / myalbum / ES / myalbumsetup.exe / {app} / ScriptDisplayString.vbs < prev    next >
Text File  |  2003-01-07  |  2KB  |  38 lines

  1. '--------------------------------------------------------------------------
  2. '            ScriptDisplayString.vbs
  3. ' This script is an example of user defined Display String generation.
  4. ' The use the macro code %SF will call a function with the following
  5. ' parameters:
  6. '    - zAlb: a reference to the current album (an "Album" object),
  7. '    - zPic: a reference to the current picture (a "Picture" object),
  8. '    - zInfo: integer value (unused, reserved for future use).
  9. ' The function returns a string containing the generated text.
  10. ' Note: loading and executing a script function can be slow, this macro
  11. ' should be used for Display Strings used for printing and HTML generation
  12. ' rather than screen display.
  13. ' This example computes the amount of megapixel the picture contains.
  14. ' The %SF macro needs two parameters: the script file (use a complete path)
  15. ' and the name of the function to call:
  16. '    %SF["ScriptDisplayString.vbs",MegaPixels]
  17. '--------------------------------------------------------------------------
  18. Option Explicit
  19. const MEGAPIX=1000000
  20. 'app.ClearTrace
  21.  
  22. function MegaPixels( zAlb, zPic, zInfo )
  23.   if zInfo = 0 then    ' Read mode
  24.   'App.Trace ">> MegaPixels called !!!"
  25.   if zPic is nothing then
  26.     MegaPixels = ">no pic !<"
  27.     exit function
  28.   end if
  29.   dim nbPx
  30.   nbPx = (zPic.w * zPic.h) / MEGAPIX
  31.  
  32.   ' Important: use CStr to ensure that the returned value is a string
  33.   MegaPixels = CStr( round(nbPx,1) & " Megapixel" )
  34.   else
  35.     zPic.sComment = app.sInfo
  36.   end if
  37. end function
  38.